package com.rui.study.demo.httpclient.cncbox;

import com.rui.study.demo.httpclient.HttpClient;

import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2019-03-19 09:55
 **/
public class ResourceTemporary {

    public static void testInfoGettingMetadata() {
        String rcs_id = "b938eac66e7941f7b9fe8b5d36957a69";
//        String rcs_id = "49";
        String unificationId = "15451018762767706";
//        String islicode = "010002-000000000000001004169979-5";
        String islicode = "010002-000000000000001000929999-4";
        String resolveURL = "www.google.com";
        String url = String.format("http://localhost:11000/v1/metadata/%s/%s/%s?resolveURL=%s",
                rcs_id, unificationId, islicode, resolveURL);
        HttpClient.get(url);
    }

    public static void testGetCulturalProductTargetFileInfoList() {
        String islicode = "010002-000000000000001000929999-4";
//        String islicode = "010001-000000000000009000030202-3";
//        String islicode = "010001-000000000000009000030202-323";
        String url = String.format("http://localhost:11000/v1/cultural-product/fileInfo?isliCode=%s",
                islicode);
        HttpClient.get(url);
    }

    public static void test() {
        String redirectUrl = URLEncoder.encode("http://45.251.21.165:11999/public/#/login/transfer-page?jump=wb");
        String url = String.format("https://api.weibo.com/oauth2/authorize?client_id=3174652650&response_type=code&redirect_uri=%s&forcelogin=true", redirectUrl);
        System.out.println(url);
        HttpClient.get(url);
//        HttpClient.get("https://api.weibo.com/oauth2/authorize?client_id=3174652650&redirect_uri=http%3A%2F%2F172.16.3.21%3A11000%2Fpublic%2F%23%2Flogin%2Ftransfer-page%3Fjump%3Dwb&response_type=code&forcelogin=true");
//        HttpClient.get("https://api.weibo.com/oauth2/authorize?client_id=3174652650&redirect_uri=http%3A%2F%2F172.16.3.21%3A11000%2Fpublic%2F%23%2Flogin%2Ftransfer-page%3Fjump%3Dwb&response_type=code&forcelogin=true");
    }

    public static void testInformGetMetadata(String address) {
        String rcsId = "b938eac66e7941f7b9fe8b5d36957a69";
        String unificationId = "15451018762767706";
        String islicode = "010005-000000000002210016999999-1";

        String url = String.format("http://%s/v1/metadata/%s/%s/%s?fileType=7",address, rcsId, unificationId, islicode);
        System.out.println(url);
        HttpClient.get(url);
    }

    public static void main(String[] args) {
//        testInfoGettingMetadata();
//        testGetCulturalProductTargetFileInfoList();
//        test();
//        testInformGetMetadata("172.16.2.141:11020");
        testInformGetMetadata("localhost:11000");
    }
}
